Public Class ConnectSummary
    Private mlID As Long
    Private mlDatabaseID As Long
    Private mlSessionID As Long
    Private msCreateDate As String = Now
    Private msLastUpdateDate As String = Now

    Private miYear As Integer = Now.Year
    Private miMonth As Integer = Now.Month
    Private miDay As Integer = Now.Day
    Private miHour As Integer = Now.Hour

    Private mlSessionCount As Long
    Private mlServerConnections As Long
    Private mlDatabaseConnections As Long

    Protected mbObjectExists As Boolean = False

    Public Sub New()
        miYear = Now.Year
        miMonth = Now.Month
        miDay = Now.Day
        miHour = Now.Hour
    End Sub

    Public Sub New(ByVal lID As Long)
        mlID = lID
        mbObjectExists = True
    End Sub

#Region "Properties"
    Public Property [Date]() As Date
        Get
            Return New Date(miYear, miMonth, miDay, miHour, 0, 0)
        End Get
        Set(ByVal value As Date)
            miYear = value.Year
            miMonth = value.Month
            miDay = value.Day
            miHour = value.Hour
        End Set
    End Property

    Public Property ID() As Long
        Get
            Return mlID
        End Get
        Set(ByVal value As Long)
            mlID = value
        End Set
    End Property

    Public Property DatabaseID() As Long
        Get
            Return mlDatabaseID
        End Get
        Set(ByVal value As Long)
            mlDatabaseID = value
        End Set
    End Property

    Public Property Year() As Integer
        Get
            Return miYear
        End Get
        Set(ByVal value As Integer)
            miYear = value
        End Set
    End Property

    Public Property Month() As Integer
        Get
            Return miMonth
        End Get
        Set(ByVal value As Integer)
            miMonth = value
        End Set
    End Property

    Public Property Day() As Integer
        Get
            Return miDay
        End Get
        Set(ByVal value As Integer)
            miDay = value
        End Set
    End Property

    Public Property Hour() As Integer
        Get
            Return miHour
        End Get
        Set(ByVal value As Integer)
            miHour = value
        End Set
    End Property

    Public Property CreateDate() As String
        Get
            Return msCreateDate
        End Get
        Set(ByVal value As String)
            msCreateDate = value
        End Set
    End Property

    Public Property LastUpdateDate() As String
        Get
            Return msLastUpdateDate
        End Get
        Set(ByVal value As String)
            msLastUpdateDate = value
        End Set
    End Property

    Public Property SessionCount() As Long
        Get
            Return mlSessionCount
        End Get
        Set(ByVal value As Long)
            mlSessionCount = value
        End Set
    End Property

    Public Property ServerConnections() As Long
        Get
            Return mlServerConnections
        End Get
        Set(ByVal value As Long)
            mlServerConnections = value
        End Set
    End Property

    Public Property DatabaseConnections() As Long
        Get
            Return mlDatabaseConnections
        End Get
        Set(ByVal value As Long)
            mlDatabaseConnections = value
        End Set
    End Property

#End Region

#Region "Data"
    Public Sub Load()
        Dim oObject As New DBConnectSummary

        oObject.Load(Me)
    End Sub

    Public Sub Save()
        Dim oObject As New DBConnectSummary

        If mbObjectExists = True Then
            oObject.Update(Me)
        Else
            Dim oNextID As New DBNextIDValue("DBConnectSummary")
            Dim lNextID As Long = oNextID.NextValue

            Me.ID = lNextID

            Me.CreateDate = Now
            oObject.Add(Me)
        End If

    End Sub

    Public Sub Delete()
        Dim oObject As New DBConnectSummary

        oObject.Delete(Me)
    End Sub
#End Region
End Class
